
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="<?php echo $this->baseUrl();?>/functions/ckeditor/ckeditor.js"></script>
<style type="text/css">
<!--
.STYLE1 {font-size: 24px}
.STYLE2 {font-size: 70px}
.STYLE7 {font-size: smaller}
.STYLE6 {font-size: medium}
-->
</style>
 	
	<!-- start about us -->
		<?php
		//初始化模板参数:$this->aboutusTitle、$this->aboutusTitleImg
		$this->aboutusTitle = 
		'四川大学网上第二课堂的学习论坛是一个特色网上交流平台，
		学生可在这里交流学习心得、体会，并体验论坛交流发帖的乐趣。';
		$this->aboutusTitleImg = $this->baseUrl().'/images/forumTitleImg.jpg';
		
		$aboutusLayout = new Zend_Layout();
		echo $aboutusLayout->render('/module/aboutus');
		?>
	<!-- end about us -->
	
	<!-- start logos -->
	<div class="logos">
		
	</div>
	<!-- end logos -->
	
	<!-- start content -->
	<div id="vg-content">

		<!-- start portfolio details -->
		<div id="portfolio-details" class="vg-page">
		
			<!-- start details -->
			<?php
				//				左侧信息
				$this->fromhref = '?fromhref=/forum/index';
				if($this->isloggin==true)
				{
					$userinfoLayout = new Zend_Layout();
					echo $userinfoLayout->render('/module/userinfo');
				}
				else
				{
					//左侧登录
					
					$loginLayout = new Zend_Layout();
					echo $loginLayout->render('/module/login');
				}
				  
			?>
			<?php
			Zend_Loader::loadFile('/functions/msubstr.php');
			?>
			<article class="border-top c-four height-auto">
			
				<div class="vg-item-article vg-portfolio-details">

					<div class="forumindexblock">
					<div class="topsearch">
						<div class="searchbox">
							<form action="<?php echo $this->baseUrl().'/forum/search';?>" method="post">
							<?php
								if(isset($this->search_key))
								{
									$search_key = $this->search_key;	
								}
								else
								{
									$search_key = '搜索';    
								} 
							?>
							<input type="text" value="<?php echo $search_key;?>" id="searchforum" name="searchforum" 
								onblur="if(this.value=='') this.value='搜索'; this.style.color='#999'; return true;"
								onfocus="if(this.value=='搜索') this.value='';this.style.color='#333'; return true;"/>
								<button type="submit">
								</button>
							
							</form>
						</div>
						<a href="<?php echo $this->baseUrl().'/forum/newforum'?>"><div class="newforum">发表新帖</div></a>
					</div>
					<ul>
						<?php
							foreach($this->allforums as $forum)
							{
							   
							    
						        echo '<li><div class="count" title="';
						        if($forum['replytoid']==0)
						        {
						            echo $forum['countreply'];
						            echo '">'.$forum['countreply'].'</div>';
						        }
						        else
						        {
						            echo '本帖是回复贴';
						            echo '">'.'回复贴'.'</div>';
						        }
							    echo '<div class="content"><div class="ti"><a href="';
							    if($forum['replytoid']==0)echo $this->baseUrl().'/forum/detail?forumid='.$forum['id'].'">';
							    else echo $this->baseUrl().'/forum/detail?forumid='.$forum['replytoid'].'">';
							    echo $this->escape($forum['title']).'</a></div>'.'<div class="content">';
							    //$content_tmp = strtr($forum['content'],'<p>','');
							    $shortcontent = cut_str($forum['content'],25);
							    //$shortcontent = cut_str($content_tmp,25);
							    
							    //$shortcontent = $forum['content'];
							    //echo $this->escape($shortcontent).'</div></div><div class="author"><p>by  ';
							    echo $shortcontent.'</div></div><div class="author"><p>by  ';
							    echo $this->escape($forum['author']).'</p><p>';
							    date_default_timezone_set("Asia/Shanghai");
							    echo gmdate('Y-m-d',$forum['time']).'</p></div></li>';
							} 
						?>
						<!-- 静态模板  
						<li>
						<div class="count" title="26个回复">26</div>
						<div class="content">
							<div class="ti"><a href="<?php echo $this->baseUrl().'/forum/detail?forumid='?>">哎呀！这离散数学还让不让人活 了！！</a></div>
							<div class="content">今天冯老师的考试让我们。。。。</div>
						</div>
						<div class="author">
						<p>by 志坚</p>
						<p>2012.7.25</p>
						</div>
						</li> -->
					</ul>
					
					<!-- pager start -->
					<?php
							if(isset($this->search_key))//搜索模式
							{
							    $this->pagerUrl = $this->baseUrl().'/forum/search';
							    $this->pagerPara = '&searchforum='.$this->search_key;
							}
							else 
							{
							    $this->pagerUrl = $this->baseUrl().'/forum/index';
							    $this->pagerPara = '';
							}
							$pagerLayout = new Zend_Layout();
							echo $pagerLayout->render('/module/pager');
					?>
					<!-- pager end -->
					</div>
					
					<!-- title -->
					<!-- end title -->
					<!-- upload start -->
					<!-- upload ends -->
					<!-- download list -->
					
					<!-- enddownload list -->
					
			  </div>
				
			</article>
			<!-- end details -->
			
	  </div>
	  <!-- end portfolio details -->
		
	</div>
	<!-- end content -->

<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-23864149-2']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
  function searchEnter(){
	if(event.keyCode==13){
		document.getElementById('searchform').submit();
		return false;
	}  
  }
</script>

